package com.zscat.mallplus.center.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zscat.mallplus.center.entity.CenterOrderRecharge;
import com.zscat.mallplus.center.mapper.CenterOrderRechargeMapper;
import com.zscat.mallplus.center.service.ICenterOrderRechargeService;
import com.zscat.mallplus.center.utils.StringUtils;

@Service
public class CenterOrderRechargeServiceImpl extends ServiceImpl<CenterOrderRechargeMapper, CenterOrderRecharge>
		implements ICenterOrderRechargeService {
	@Autowired
	private CenterOrderRechargeMapper centerOrderRechargeMapper;

	@Override
	public List<CenterOrderRecharge> selectCenterOrderRechargeList(CenterOrderRecharge centerOrderRecharge,
			Integer pageNum, Integer pageSize) {
		Page<CenterOrderRecharge> page = new Page<CenterOrderRecharge>(pageNum, pageSize);
		page.setDesc("a.payment_time");
		if (StringUtils.isNotEmpty(centerOrderRecharge.getBeginTime())
				&& StringUtils.isNotEmpty(centerOrderRecharge.getEndTime())) {
			centerOrderRecharge.setBeginTime(centerOrderRecharge.getBeginTime() + " 00:00:00");
			centerOrderRecharge.setEndTime(centerOrderRecharge.getEndTime() + " 23:59:59");
		}
		List<CenterOrderRecharge> list = centerOrderRechargeMapper.selectCenterOrderRechargeList(page,
				centerOrderRecharge);
		return list;
	}

}
